package com.lanou.myapplication;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.support.v4.view.PagerAdapter;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.ImageRequest;

/**
 * Created by dllo on 15/11/3.
 */
public class ImgActivity extends Activity

{
    protected static final String TAG = "ImgActivity";
    private int[] mImgIds;
    private String pic;
    private MyJazzyViewPager mViewPager;
    private RequestQueue queue;
    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_img);
        mImgIds = new int[] { R.mipmap.zixun, R.mipmap.zixun, R.mipmap.zixun,
                R.mipmap.zixun};


        mViewPager = (MyJazzyViewPager) findViewById(R.id.id_viewPager);
        mViewPager.setAdapter(new PagerAdapter()
        {

            @Override
            public boolean isViewFromObject(View arg0, Object arg1)
            {
                return arg0 == arg1;
            }

            @Override
            public void destroyItem(ViewGroup container, int position,
                                    Object object)
            {
                container.removeView((View) object);
            }

            @Override
            public Object instantiateItem(ViewGroup container, int position)
            {
                ImageView imageView = new ImageView(ImgActivity.this);
                imageView.setImageResource(mImgIds[position]);
                imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
                container.addView(imageView);
                mViewPager.setObjectForPosition(imageView, position);
                return imageView;
            }

            @Override
            public int getCount()
            {
                return mImgIds.length;
            }
        });

    }



}

